package com.hyq.learn.api.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author heyuqin
 * @date 2025/8/14 16:22
 */
@Service
public class AsyncService {

    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncService.class);

    public void async1() {
        LOGGER.info("methodName:{}, thread name:{}", "async1", Thread.currentThread().getName());
    }

    @Async
    public void async2() {
        LOGGER.info("methodName:{}, thread name:{}", "async2", Thread.currentThread().getName());
    }

    @Async("executorTwo")
    public void async3() {
        LOGGER.info("methodName:{}, thread name:{}", "async3", Thread.currentThread().getName());
    }

    @Async("executorService")
    public void async4() {
        LOGGER.info("methodName:{}, thread name:{}", "async4", Thread.currentThread().getName());
    }


}
